<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <style>
        .num_error{  right:0.5rem; top:0; color:#cb1448;}
    </style>
    <title>设置姓名</title>
    <script type="text/javascript">
        function checkLength() {
            var userName = document.getElementById("userName"); //获取昵称
            if(userName.value==null||userName.value==""){
                $("#user-name-label > .num_error").remove();
                $("#user-name-label").append('<span class="num_error">请输入昵称</span>');
            }else{
                document.phoneForm.submit();
            }
        }
    </script>
</head>
<body>
<form:form method="post" name="phoneForm" action="${ctx}/user/update_name">
<article class="viewports">
    <ul class="plr20 lh1-5 mt30">
        <li class="ptb20">
            <div class="c8">
                <div class="odr2 plr10 mt20 b-ffffff">
                    <input name="userName" id="userName" class="i_text" type="text"  placeholder="姓名" value="${name}">
                </div>
            </div>
            <span id="user-name-label"></span>
        </li>
    </ul>
    <div class="tac ptb30"><button class="i_btn b-2db22d cf r5 lh2 plr120" type="button" onclick="checkLength();">保存</button></div>
</article>
</form:form>
</body>
</html>